﻿using System;
using System.Collections.Generic;
using System.Text;
using YN.Core;
using KKCai.HNKL.DAL;
using KKCai.HNKL.Model;
using KKCai.HNKL.BLL;
using KKCai.HNKL;

namespace KKCai.Web.Page
{
    public class Omit : BasePage
    {
        private const int limit = 10;

        public override string GetTemplatePath()
        {
            return "omit.htm";
        }

        public override IDictionary<string, object> GetPageData()
        {
            VelocityDictionary dict = new VelocityDictionary();

            string type = GetStringUrlParam("type");
            string order = GetStringUrlParam("order");

            if (String.IsNullOrEmpty(type))
            {
                Response.Redirect("~/");
            }

            int p = GetIntUrlParam("p", 1);
            int start = (p - 1) * limit;

            dict.Add("List", new LotteryManager().List(type, order, start, limit));
            dict.Add("idx", p - 1); //注意
            dict.Add("Type", type.ToUpper());

            int count = 0;
            switch (type.ToUpper())
            {
                case "A1": count = 20;
                    break;
                case "A2": count = 380;
                    break;
                case "A3": count = 6840;
                    break;
                case "P2": count = 190;
                    break;
                case "P3": count = 1140;
                    break;
                case "N2": count = 190;
                    break;
                case "N3": count = 1140;
                    break;
                case "N4": count = 4845;
                    break;
                case "N5": count = 15504;
                    break;
                default:
                    break;
            }

            dict.Add("Pager", PagerHelper.GetPagerHtml(count, limit, p));

            return dict;
        }
    }
}
